<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var isIsomorphic = function(s, t) {
        if(s.length!==t.length) return false;
        let map = new Map();
        for(let i=0;i<s.length;i++){
            if(map.has(s[i])){
                if(map.get(s[i])!==t[i]){
                    return false;
                }
            }
            else{
                if(map.has(t[i])){
                    return false;
                }
            }
            map.set(s[i],t[i]);
            map.set(t[i],s[i]);
        }
        return true;
    };
    // console.log(isIsomorphic("egg", "add"));
    console.log(isIsomorphic("foo", "bar"));
    // console.log(isIsomorphic("paper", "title"));
    // console.log(isIsomorphic("paper", "title"));
</script>
</body>
</html>
